class PersonController {
    
  def scaffold = Person

  def handleLogin = {
	def user = Person.findWhere(userName:params['userName'], password:params['password'])
   
  	if (!user) {
		flash.message = "Login Failed."
		redirect(action:'login')
		return
        }
        else{
	    session.user = user
	    redirect(action:"home")
	}
  }	


  def logout = {
	if(session.user) {
		session.user = null
		redirect(action:'login')
	}
  }

  def login = {} 
  def home = {}
}


